package com.jiaanpei.frameproject.modle.bean.base;
/**
 * 网络请求结果 基类
 *
 * @param <T>
 */
public class BaseResponse<T> {
    public BaseResponseHead head = new BaseResponseHead();
    public BaseResponseBody<T> body = new BaseResponseBody<T>();

    public boolean isSuccess() {
        return head != null && head.status.equalsIgnoreCase("success");
    }

    public String getErrorMessage(){
        if(head != null){
            return head.errMsg;
        }
        return "系统异常";
    }

    public static class BaseResponseHead {
        /**
         * head : {"timeStamp":"2018-07-03 10:03:06","requestType":"01","errCode":"000","errMsg":"请使用修理厂账户进行登录","status":"FAILED"}
         * body : {"baseInfo":{"status":"07"}}
         */

        /**
         * timeStamp : 2018-07-03 10:03:06
         * requestType : 01
         * errCode : 000
         * errMsg : 请使用修理厂账户进行登录
         * status : FAILED
         */

        public String timeStamp;
        public String requestType;
        public String errCode;
        public String errMsg;
        public String status;

    }

    public static class BaseResponseBody<T> {
        public T baseInfo;
    }
}
